package com.bwie.auth.feign.fallback;

import com.bwie.auth.feign.AuthFegin;
import com.bwie.common.domain.User;
import com.bwie.common.result.Result;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class AuthFeginFallBackFactory implements FallbackFactory<AuthFegin> {
    @Override
    public AuthFegin create(Throwable cause) {
        return new AuthFegin() {
            @Override
            public Result<User> login(String userName) {
                return Result.error(cause.getMessage());
            }
        };
    }

//    @Override
//    public AuthFegin create(Throwable cause) {
//        return new AuthFegin() {
//            @Override
//            public Result<User> login(String userName) {
//                return Result.error(cause.getMessage());
//            }
//        };
//    }
}
